package com.案例.复制图片;

import lombok.SneakyThrows;

import java.io.FileInputStream;
import java.io.FileOutputStream;

public class Demo {
    @SneakyThrows
    public static void main(String[] args) {
        //读取图片文件
        FileInputStream fileInputStream = new FileInputStream("C:\\Users\\lsc1999\\Desktop\\ll.jpg");

        //创建写入文件
        FileOutputStream fileOutputStream = new FileOutputStream("jj.jpg");

        //一次读一个字节数组
        byte[] bytes = new byte[1024];
        int by;
        while ((by=fileInputStream.read(bytes))!=-1){
            fileOutputStream.write(bytes,0,by);
        }

        fileInputStream.close();
        fileOutputStream.close();
    }
}
